package com.caiden_micheal.position.web;

import com.caiden_micheal.base.aop.annotation.PermissionVerify;
import com.caiden_micheal.base.domain.AjxResult;
import com.caiden_micheal.position.service.PositionService;
import com.caiden_micheal.position.vo.AddPositionPermissionVO;
import com.caiden_micheal.position.vo.PositionAuthorityRemoveVO;
import com.caiden_micheal.position.vo.PositionPermissionQueryVO;
import com.caiden_micheal.position.vo.PositionQueryVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/position")
public class PositionPermissionController {
    @Autowired
    private PositionService positionService;

    @PermissionVerify(permissionArray = {"sys:permissionManagement:assignPosition"})
    @PostMapping("/addPositionPermission")
    public AjxResult addPermission(@RequestBody PositionPermissionQueryVO positionPermissionQueryVO) {
        return positionService.addPermission(positionPermissionQueryVO);
    }

    @PermissionVerify(permissionArray = {"sys:permissionManagement:assignPosition"})
    @PostMapping("/positionQueryExcludeAuthority")
    public AjxResult positionQueryExcludeAuthority(@RequestBody PositionQueryVO positionQueryVO) {
        return AjxResult.success(positionService.positionQueryExcludeAuthority(positionQueryVO));
    }

    @PermissionVerify(permissionArray = {"sys:permissionManagement:assignPosition", "sys:positionManagement:assignPermission"})
    @PostMapping("/positionRemoveAuthority")
    public AjxResult positionRemoveAuthority(@RequestBody PositionAuthorityRemoveVO positionAuthorityRemoveVO) {
        return positionService.positionRemoveAuthority(positionAuthorityRemoveVO);
    }

    @PermissionVerify(permissionArray = {"sys:positionManagement:assignPermission"})
    @PostMapping("/positionAddPermission")
    public AjxResult positionAddPermission(@RequestBody AddPositionPermissionVO addPositionPermissionVO) {
        return positionService.positionAddPermission(addPositionPermissionVO);
    }
}
